<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no,width=device-width">
    <meta name="format-detection" content="telephone=yes"/>
    <title>哈啰通用</title>
    <link rel="stylesheet" href="css/reset.css">
    <link rel="stylesheet" href="css/base.css">
    <link rel="stylesheet" href="css/product.css">
    <style>
.pro-smallBox{cursor: pointer;}
    </style>
</head>
<body>
<div class="wrapper">
    <div class="container">
    <div class="loading-warp">
        <div class="box">
            <div class="box1">
                <img src="images/loading.gif" />
                <span class="text">下拉开始刷新</span>
            </div>
        </div>
    </div>
    <div class="product-nav">
       <ul>
           <li class="brand"><span>品牌</span></li>
           <li class="class-b"><span>分类</span></li>
           <li class="sales"><span>销量</span> </li>
       </ul>
    </div>
    <!--导航选项-->
    <div class="background hide1">
        <div class="brand-box hide1 f1">
            <ul id="test">
                <li>AHT <span class="hide1 Code">010101</span></li>
                <li>PARIS<span class="hide1 Code">01010101</span></li>
                <li>SIGMA<span class="hide1 Code">01010102</span></li>
                <li>SINGAPORE<span class="hide1 Code">01010103</span></li>
                <li>赫斯基<span class="hide1 Code">010102</span></li>
                <li>freor<span class="hide1 Code">010103</span></li>
                <li>富信<span class="hide1 Code">010201</span></li>
            </ul>
        </div>
        <div class="class-box f1">
            <ul id="test1">
                <li class="test1-li"><span class="test1-li1">手推车</span></li>
                <li class="test1-li"><span class="test1-li2">冷柜</span></li>
                <li class="test1-li"><span class="test1-li3">酒柜</span></li>
                <li class="test1-li"><span class="test1-li4">货架</span></li>
                <li class="test1-li"><span class="test1-li5">收银台</span></li>
            </ul>
        </div>
    </div>
    <!--产品展示-->
    <div class="null hide1">
        <div class="null-div">
            <img src="images/Artboard%20116.png" alt="">
            <span>暂未找到分类内容哦！</span>
        </div>
    </div>
    <div class="product-show">
        <div class="pro-small">
        </div>
        <div class="down-more hide1">已经全部加载完毕</div>
    </div>
    </div>
</div>
<script src="js/jquery-1.8.3.min.js"></script>
<script src="js/base.js"></script>
<script src="js/touch.js"></script>
<script src="js/pull.js"></script>
<script>
    var params = getUrlVars('url=http://localhost/rest/ProductFenlei?');
    console.log(params);

    function getUrlVars(url) {
        var hash;
        var myJson = {};
        var hashes = url.slice(url.indexOf('?') + 1).split('&');
        for (var i = 0; i < hashes.length; i++) {
            hash = hashes[i].split('=');
            myJson[hash[0]] = hash[1];
        }
        return myJson;
    }
    $('#test li').click(function(){
       var codes = $(this).find('.Code').text();

    $.ajax({
        type:"POST",
        url:'/rest/ProductFenlei?',
        data:JSON.stringify({//强制转换为数组格式
            "Ccode":codes
        }),
        contentType:"application/json; charset=utf-8",
        dataType:'json',
        success:function(data){
            console.log(data);
            var comHtml='';
            $('.product-show').show();
            var Array=data.SDTInventoryListViewCollection;
            for(var i=0;i<Array.length;i++){
                var datas=Array[i];
                var code=datas.InventoryListViewcInvCode;
                var name=datas.InventoryListViewcInvName;
                var Std=datas.InventoryListViewcInvStd;
                var price=datas.InventoryListViewfRetailPrice;
                var imgs=datas.InventoryListViewPicture;
                comHtml+= '<div class="pro-smallBox dis_in">'+
                    '<div class="pic-box1">'+
                    '<img class="product-pic1" src="http://app.besenz.cn:9778/' + imgs + '" onerror="onerror=null;src=\'../../images/Artboard 79 Copy.png\'" alt="">'+
                    '</div>'+
                    '<div>'+
                    '<div class="pro-mixi dis_in">'+
                    '<span class="codes hide1">'+code+'</span>'+
                    '<span class="hide1">'+Std+'</span>'+
                    '<span class="pro-style dis_b fz9 f2d">'+name+'</span>'+
                    '<span class="pro-price dis_b f3"><span>'+price+'</span></span>'+
                    '</div>'+
                    '</div>'+
                    '</div>'
            }
            $('.pro-small').html(comHtml);
            if(comHtml==''){
                $('.null').show();
                $('body').css({'background':'#fff'});
            }else {
                $('.null').hide();
                $('body').css({'background':'#f2f2f2'});
            }
        }
    });
});
    $.ajax({
        url:'/rest/FenleiSearchPanel_Level_Detail?Searchtext=&gxid=56',
        type:"GET",
        dataType: 'json',
        data:'id',
        success:function(data){
            var comHtml='';
            var Array=data["Sdtinventorylistviewcollection"];
            for(var i=0;i<Array.length;i++){
                var datas=Array[i];
                var name=datas.InventoryListViewcInvName;
                var price=datas.InventoryListViewfRetailPrice;
                var imgs=datas.InventoryListViewPicture;
                var code=datas.InventoryListViewcInvCode;
                var Std = datas.InventoryListViewcInvStd;
               comHtml+=
                    '<div class="pro-smallBox dis_in">'+
                    '<div class="pic-box1">'+
                    '<img class="product-pic1" src="http://app.besenz.cn:9778/' + imgs + '" onerror="onerror=null;src=\'../../images/Artboard 79 Copy.png\'" alt="">'+

                    '</div>'+
                    '<div>'+
                    '<div class="pro-mixi dis_in">'+
                   '<span class="codes hide1">'+code+'</span>'+
                   '<span class="hide1">'+Std+'</span>'+
                    '<span class="pro-style dis_b fz9 f2d">'+name+'</span>'+
                    '<span class="pro-price dis_b f3"><span>'+price+'</span></span>'+
                    '</div>'+
                    '</div>'+
                    '</div>'
            }
            $('.pro-small').html(comHtml);
            $('.pro-smallBox').live('click', '.product-pic1', function(e){
                var codes = $(this).find('.codes').text();
                var url='product%20information.html?Inventorylistviewcinvcode='+codes+'&start=0&count=15&gxid=2';
                window.location.href = url;
                localStorage.setItem("key",codes);
                localStorage.key = "value"
            });
        }
    });

</script>
</body>
</html>